<? //SELECT DISTINCT factuurregel.kwantiteit, factuurregel.idartikelen, artikelen.name, factuurregel.leverprijs FROM factuurregel, artikelen WHERE (idfactuur = '15') AND (artikelen.idartikelen = factuurregel.idartikelen)
session_start();
require_once('Local_Settings.php');
require_once('cart/inc/functions/Cart_Functions.php');
if (!(isset($_SESSION['myusername']) && $_SESSION['mypassword'] != '')) {
header ("Location: http://www.group3productions.info/main_login.php");
}
include 'config.php';
?>

<!--Alhier het systeem voor het behoud van een layout op de hele website. Alle wijzigingen aan de layout dienen te gebeuren in de header,body en footer.php bestanden. Enkel de content mag in dit bestand staan.-->
<?php include('style/header-1.php');//hieronder komt de linkerbalk met artikelen ?>
<? include('menu.php'); ?>
<?php include('style/body-2.php');//hieronder het midden van de pagina ?>

<?php

$name=$_GET['id'];
$username=$_SESSION['myusername'];
$result = mysql_query("SELECT email FROM klant WHERE id = (SELECT idklant FROM factuur WHERE idfactuur = '{$name}')");
if (!$result) {
    die("Query to show fields from table failed");
}
$row=mysql_fetch_array($result);
$klantid=$row['email'];

if($klantid!=$username)
{
	echo("Je hebt geen toegang tot deze bestelling!");
	include('style/body-3.php');//hieronder de rechterbalk
	echo ( DisplayCartBald($Session_Prefix,$Currency_Symbol,$Currency_Code));
	include('style/footer-4.php');
	die();
}


//$table = 'factuurregel';
//$table2 = 'artikelen';


$result = mysql_query("SELECT DISTINCT factuurregel.kwantiteit, factuurregel.idartikelen, artikelen.name, factuurregel.leverprijs FROM factuurregel, artikelen WHERE (idfactuur = {$name}) AND (artikelen.idartikelen = factuurregel.idartikelen)");
if (!$result) {
    die("2 | Query to show fields from table failed");
}

$fields_num = mysql_num_fields($result);
$total = 0;

echo "<table border='1' align='center' cellspacing='0' bordercolordark='white' bordercolorlight='black'><tr>";

echo "<td><b>Qt.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
echo "<td><b>ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
echo "<td><b>Artikel&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td>";
echo "<td><b>Prijs&nbsp;&nbsp;</b></td>";

echo "</tr>\n";

while($row = mysql_fetch_row($result))
{
	$idcode=$row[1];
	
	$row[2]=afkorten($row[2], 18);
	$total = ($total + $row[3]);
	
	//http://www.group3productions.info/artikelen.php?act=view&id=432041
	
    echo "<tr>";

    foreach($row as $cell)
        echo "<td><a href=\"http://www.group3productions.info/artikelen.php?act=view&id=$idcode\">$cell</a></td>";
    echo "</tr>\n";
}
mysql_free_result($result);
?>
<h3 style="text-align:center">Bestelling #<? echo $name; ?> specificatie</h3>
<?
echo "</table>";
echo "</br>";
echo "</br>";
echo "<table border='1' align='center' cellspacing='0' bordercolordark='white' bordercolorlight='black'><tr>";
echo "</tr>\n";

echo "<tr><td>Totaalprijs:&nbsp;&nbsp;</td><td>$total&nbsp;&nbsp;</td></tr>\n";

$result = mysql_query("SELECT factuurdatum FROM factuur WHERE idfactuur = {$name}");
if (!$result) {
    die("3 | Query to show fields from table failed");
}
$row=mysql_fetch_array($result);
$geplaatst=$row['factuurdatum'];
echo "<tr><td>Geplaatst:&nbsp;&nbsp;</td><td>$geplaatst&nbsp;&nbsp;</td></tr>\n";

$result = mysql_query("SELECT betaald FROM factuur WHERE idfactuur = {$name}");
if (!$result) {
    die("3 | Query to show fields from table failed");
}
$row=mysql_fetch_array($result);
if($row['betaald'] == 0)
{
	echo "<tr><td>Betaald:&nbsp;&nbsp;</td><td>NEE&nbsp;&nbsp;</td></tr>\n";
}
else
{
	echo "<tr><td>Betaald:&nbsp;&nbsp;</td><td>JA&nbsp;&nbsp;</td></tr>\n";
}

$result = mysql_query("SELECT verzonden FROM factuur WHERE idfactuur = {$name}");
if (!$result) {
    die("4 | Query to show fields from table failed");
}
$row=mysql_fetch_array($result);
if($row['verzonden'] == 0)
{
	echo "<tr><td>Verzonden:&nbsp;&nbsp;</td><td>NEE&nbsp;&nbsp;</td></tr>\n";
}
else
{
	echo "<tr><td>Verzonden:&nbsp;&nbsp;</td><td>JA&nbsp;&nbsp;</td></tr>\n";
}

$result = mysql_query("SELECT datum_verzending FROM factuur WHERE idfactuur = {$name}");
if (!$result) {
    die("5 | Query to show fields from table failed");
}
$row=mysql_fetch_array($result);
if($row['datum_verzending'] == '0000-00-00')
{
	echo "<tr><td>Datum verzending:&nbsp;&nbsp;</td><td>N.V.T.&nbsp;&nbsp;</td></tr>\n";
}
else
{
	$datum = $row['datum_verzending'];
	echo "<tr><td>Datum verzending:&nbsp;&nbsp;</td><td>$datum&nbsp;&nbsp;</td></tr>\n";
}
echo "</table>";

$result = mysql_query("SELECT * FROM klant WHERE id = (SELECT idklant FROM factuur WHERE idfactuur = {$name})");
if (!$result) {
    die("6 | Query to show fields from table failed");
}
$row=mysql_fetch_array($result);

?>

</br></br>
<h3 style="text-align:center; text-decoration:underline">Personalia</h3>
</br><h4 style="text-align:center">
<? echo $row['voornaam']; ?>&nbsp;<? echo $row['tussenvoegsel']; ?>&nbsp;<? echo $row['achternaam']; ?><br><? echo $row['adres']; ?><br><? echo $row['postc']; ?>&nbsp;&nbsp; <? echo $row['woonplaats']; ?>
</br></br>
<? echo $row['telefoon']; ?>
</h4></p>




<?php include('style/body-3.php');//hieronder de rechterbalk ?>
<? echo ( DisplayCartBald($Session_Prefix,$Currency_Symbol,$Currency_Code)); ?> 
<?php include('style/footer-4.php');?>